package main

import (
	"encoding/json"
	"fmt"
)

type message struct {
	JobName string `json:"jobName"` // 任务名称
	JobType string `json:"jobType"` // 任务类型（start, stop）
	CronStr string `json:"cronStr"` // 执行时间（* * * * *）
	Config  string `json:"config"`  // 配置项目
}

func main() {
	var xxx = `{"jobName":"ldap","cronStr": "* * * * *", config:{"host":"47.93.249.165","port":"389","bindDn":"cn=admin,dc=example,dc=org","bindPwd":"admin","baseDn":"ou=users,dc=example,dc=org","tls":0,"filter":"(\u0026(objectClass=organizationalPerson)(cn=%s))"}}`

	var msg message

	if err := json.Unmarshal([]byte(xxx), &msg); err != nil {
		fmt.Printf("error is %s \n", err.Error())
	} else {
		fmt.Printf("%+v \n", msg)
	}
}
